//
//  UIBarButtonItem+ZTItem.m
//  ZtEmail
//
//  Created by Zhengtong on 15/11/9.
//  Copyright © 2015年 Zhengtong. All rights reserved.
//

#import "UIBarButtonItem+ZTItem.h"
#import "UIView+Frame.h"
#define DEVICE_WIDTH  [UIScreen mainScreen].bounds.size.width
#define DEVICE_HEIGHT [UIScreen mainScreen].bounds.size.height
@implementation UIBarButtonItem (ZTItem)



+(UIBarButtonItem *)leftBarButtonItemTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents
{
    UIButton *cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];
    cancelButton.frame = CGRectMake(10, 20, 40, 22);
    [cancelButton setTitle:@"取消" forState:UIControlStateNormal];
    [cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    cancelButton.titleLabel.font = [UIFont boldSystemFontOfSize:15];
    [cancelButton addTarget:target action:action forControlEvents:controlEvents];
    return  [[UIBarButtonItem alloc] initWithCustomView:cancelButton];
}

+(UIBarButtonItem *)rightBarButtonItemTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents
{
    UIButton* filshButton = [UIButton buttonWithType:UIButtonTypeCustom];
    filshButton.frame = CGRectMake(DEVICE_WIDTH-50, 20, 40, 22);
    [filshButton setTitle:@"完成" forState:UIControlStateNormal];
    [filshButton setTitleColor:[UIColor whiteColor]  forState:UIControlStateNormal];
    filshButton.titleLabel.font = [UIFont boldSystemFontOfSize:15];
    [filshButton addTarget:target action:action forControlEvents:controlEvents];
    return  [[UIBarButtonItem alloc] initWithCustomView:filshButton];
}


@end
